//
//  ActivityTableViewCell.m
//  豆瓣
//
//  Created by dllo on 15/11/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "ActivityTableViewCell.h"

@interface ActivityTableViewCell()

@end

@implementation ActivityTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createCell];
    }
    
    return self;
}

- (void)createCell {
    
    /******************************** 自定义cell ***********************************/

    
    // 蓝灰的背景图片
    UIImageView *backgroundImageV = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, [UIScreen mainScreen].bounds.size.width - 30, 168)];
    backgroundImageV.image = [UIImage imageNamed:@"bg_eventlistcell.png"];
    [self addSubview:backgroundImageV];
    [backgroundImageV release];
    
    // 白色背景图片
    UIImageView *titleBackgroundImageV = [[UIImageView alloc] initWithFrame:CGRectMake(5, 35, backgroundImageV.frame.size.width - 10, backgroundImageV.frame.size.height - 10 - 32)];
    titleBackgroundImageV.image = [UIImage imageNamed:@"bg_share_large.png"];
    [backgroundImageV addSubview:titleBackgroundImageV];
    [titleBackgroundImageV release];
    
    // 活动标题Label
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(8, 10, backgroundImageV.frame.size.width - 10, titleBackgroundImageV.frame.origin.y - backgroundImageV.frame.origin.y - 10)];
    self.nameLabel.text = @"加载中...";
    self.nameLabel.font = [UIFont systemFontOfSize:19];
    [backgroundImageV addSubview:self.nameLabel];
    [self.nameLabel release];
    
    //时间标志图片
    UIImageView *timeImageV = [[UIImageView alloc] initWithFrame:CGRectMake(5, 10, 22, 22)];
    timeImageV.image = [UIImage imageNamed:@"icon_date@2x.png"];
    [titleBackgroundImageV addSubview:timeImageV];
    [timeImageV release];
    
    // 时间Label
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(32, timeImageV.frame.origin.y, 188, timeImageV.frame.size.height)];
    self.timeLabel.text = @"加载中...";
    [titleBackgroundImageV addSubview:self.timeLabel];
    self.timeLabel.font = [UIFont systemFontOfSize:15];
    [self.timeLabel release];
    
    //地址标志图片
    UIImageView *addressImageV = [[UIImageView alloc] initWithFrame:CGRectMake(timeImageV.frame.origin.x, timeImageV.frame.origin.y + timeImageV.frame.size.height + 5, timeImageV.frame.size.width, timeImageV.frame.size.height)];
    addressImageV.image = [UIImage imageNamed:@"icon_spot.png"];
    [titleBackgroundImageV addSubview:addressImageV];
    [addressImageV release];
    
    // 地址Label
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.timeLabel.frame.origin.x, addressImageV.frame.origin.y, self.timeLabel.frame.size.width, self.timeLabel.frame.size.height)];
    self.addressLabel.text = @"加载中...";
    [titleBackgroundImageV addSubview:self.addressLabel];
    self.addressLabel.font = [UIFont systemFontOfSize:15];
    [self.addressLabel release];
    
    //类型标志图片
    UIImageView *typeImageV = [[UIImageView alloc] initWithFrame:CGRectMake(timeImageV.frame.origin.x, addressImageV.frame.origin.y + addressImageV.frame.size.height + 6, timeImageV.frame.size.width, timeImageV.frame.size.height)];
    typeImageV.image = [UIImage imageNamed:@"icon_catalog.png"];
    [titleBackgroundImageV addSubview:typeImageV];
    [typeImageV release];
    
    // 类型Label
    self.typeressLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.timeLabel.frame.origin.x, typeImageV.frame.origin.y, self.addressLabel.frame.size.width, self.addressLabel.frame.size.height)];
    self.typeressLabel.text = @"加载中...";
    self.typeressLabel.font = [UIFont systemFontOfSize:15];
    [titleBackgroundImageV addSubview:self.typeressLabel];
    [self.typeressLabel release];
    
    //感兴趣Label
    UILabel *interestLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeImageV.frame.origin.x + 8, titleBackgroundImageV.frame.size.height - 29, 60, 15)];
    interestLabel.text = @"感兴趣 :";
    interestLabel.font = [UIFont systemFontOfSize:15];
    [titleBackgroundImageV addSubview:interestLabel];
    [interestLabel release];
    
    self.interestLabel = [[UILabel alloc] initWithFrame:CGRectMake(interestLabel.frame.origin.x + interestLabel.frame.size.width, interestLabel.frame.origin.y, 50, interestLabel.frame.size.height)];
    self.interestLabel.text = @"...";
    [titleBackgroundImageV addSubview:self.interestLabel];
    self.interestLabel.textColor = [UIColor redColor];
    [self.interestLabel release];
    
    //参加Label
    UILabel *joinLabel = [[UILabel alloc] initWithFrame:CGRectMake(timeImageV.frame.origin.x + 3 + 116, titleBackgroundImageV.frame.size.height - 29, 50, 15)];
    joinLabel.text = @"参加 :";
    joinLabel.font = [UIFont systemFontOfSize:15];
    [titleBackgroundImageV addSubview:joinLabel];
    [joinLabel release];
    
    self.joinLabel = [[UILabel alloc] initWithFrame:CGRectMake(joinLabel.frame.origin.x + joinLabel.frame.size.width - 7, joinLabel.frame.origin.y, 50, joinLabel.frame.size.height)];
    self.joinLabel.text = @"...";
    [titleBackgroundImageV addSubview:self.joinLabel];
    self.joinLabel.textColor = [UIColor redColor];
    [self.joinLabel release];
    
    //简介图片
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(230.5, 6, 97, titleBackgroundImageV.frame.size.height - 12)];
    self.imageV.image = [UIImage imageNamed:@"picholder.png"];
    [titleBackgroundImageV addSubview:self.imageV];
    [self.imageV release];
    
}

- (void)awakeFromNib {
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    
    [super setSelected:selected animated:animated];
}

@end
